<template>
	<el-dialog
	  title="检验项"
	  :visible.sync="visible"
	  :before-close="close"
	  width="70%">
	  <el-table :data="dataList">
	    <el-table-column
	    	prop="inspectionCategoryName"
	    	header-align="center"
	    	align="center"
	    	label="分类" />
	    <el-table-column
	    	prop="inspectionItemName"
	    	header-align="center"
	    	align="center"
	    	label="名称" />
	    <el-table-column
	    	prop="insideInspectionItemValue"
	    	header-align="center"
	    	align="center"
	    	label="内控标准值">
	      <template slot-scope="{row}">
	        <span v-html="row.insideInspectionItemValue"></span>
	      </template>
	    </el-table-column>
	    <el-table-column
	      prop="itemConclusionMerge"
	      header-align="center"
	      align="center"
	      label="检验结果" />
	    <el-table-column
	      prop="itemVerdict"
	      header-align="center"
	      align="center"
	      label="结果判断"
	      width="100">
	      <template slot-scope="{row}">
	        {{ row.itemVerdict == 0 ? '符合规定' : row.itemVerdict == 1 ? '不符合规定' : null }}
	      </template>
	    </el-table-column>
	    <el-table-column
	      prop="inspectionUserName"
	      header-align="center"
	      align="center"
	      label="检验人" />
	    <el-table-column
	      prop="startTime"
	      header-align="center"
	      align="center"
	      label="检验开始时间"
	      width="110">
	      <template slot-scope="{row}">
	        {{ row.startTime | changeTime }}
	      </template>
	    </el-table-column>
	    <el-table-column
	      prop="endTime"
	      header-align="center"
	      align="center"
	      label="检验结束时间"
	      width="110">
	      <template slot-scope="{row}">
	        {{ row.endTime | changeTime }}
	      </template>
	    </el-table-column>
	  </el-table>
	  <span slot="footer" class="dialog-footer">
	    <el-button type="primary" class="pan-btn primary-btn" @click="close()">关 闭</el-button>
  	</span>
	</el-dialog>
</template>

<script>
	import { CODE_OK } from '@/common/js/config'
  import { getItemsByCheckId } from '@/api/check'
	import { isBlank,parseTime } from '@/common/js/utils'
	export default {
		data() {
			return {
				visible: false,
        dataList: []
			}
		},
		props: ["childDataForm"],
		created() {
			if (!isBlank(this.childDataForm)) {
        this.getInfo()
        this.visible = true
			}
		},
		methods: {
      getInfo() {
        const params = {
          checkId: this.childDataForm.checkId
        }
        getItemsByCheckId(params).then(res => {
          if(res.code === CODE_OK) {
            this.dataList = res.info.items
          }else{
            this.$message.error(res.msg)
          }
        })
      },
			close() {
        this.$emit('close')
				this.visible = false
			}
    }
	}
</script>

<style scoped>
</style>
